<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>题目管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="__PUBLIC__/BeginnerAdmin/plugins/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="__PUBLIC__/BeginnerAdmin/css/global.css" media="all">
    <link rel="stylesheet" href="__PUBLIC__/BeginnerAdmin/plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="__PUBLIC__/BeginnerAdmin/css/table.css"/>
</head>
<body>
<form>
    <div class="admin-main">
        <blockquote class="layui-elem-quote">

            <a href="javascript:;" class="layui-btn" id="add" onclick="NewTopic('<{$assignmentid}>');">
                <i class="layui-icon">&#xe608;</i> 添加题目
            </a>
            <div class="layui-inline">
                <label class="layui-form-label"></label>
                <div class="layui-input-inline">
                    <input type="text" name="so" lay-verify="so" autocomplete="off" class="layui-input"
                           placeholder="请输入要搜索的内容">
                </div>
                <a href="javascript:;" class="layui-btn" id="search">
                    <i class="layui-icon">&#xe615;</i> 搜索
                </a>
        </blockquote>

        <fieldset class="layui-elem-field">
            <legend>题目列表</legend>
            <div class="layui-field-box layui-form">
                <table id="table" lay-filter="table"></table>

                <div class="layui-form-item">
                    <div class="layui-inline">
                        <div class="layui-input-inline" style="width: 200px;">
                            <select name="operation" lay-filter="operation">
                                <option value="">操作</option>
                                <option value="delect">删除</option>
                                <option value="update">更改大题号</option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>

        </fieldset>
        <div class="admin-table-page">
            <div id="paged" class="page">

            </div>
        </div>
    </div>
</form>
<script type="text/javascript" src="__PUBLIC__/BeginnerAdmin/plugins/layui/layui.js"></script>
<script src="__PUBLIC__/Jquery/Pulgin/jquery-1.9.1.js"></script>
<script>
    layui.use(['layer', 'table', 'form'], function () {
        var $ = layui.jquery,
            layer = layui.layer,
            table = layui.table,
            form = layui.form;
        var tableloding = table.render({
            elem: '#table',
            url: "<{:U('ExamRead/ReaderQuery')}>",
            where: {assignmentid: '<{$assignmentid}>'},
            method: 'post',
            limit:30,
            page: true,
            cols: [[
                {fixed: 'left', title: 'ID', width: 40, checkbox: true}
                ,{field: 'name',fixed: 'left', title: '考生名', width: 110}
                , {field: 'start_time',  fixed: 'left', title: '开始做题时间', width: 160, templet: '#start_time'}
                , {field: 'finish_time', fixed: 'left', title: '结束做题时间', width: 160, templet: '#finish_time'}
                , {field: 'examread_pattern', title: '阅卷模式', width: 100, templet: '#examread_pattern'}
                , {field: 'is_examread', title: '是否批阅', width: 100, templet: '#is_examread'}
                , {field: 'system_score', title: '系统判分', width: 100}
                , {field: 'finally_score', title: '最后得分', width: 100, edit:true}
                , {fixed: '', fixed: 'right', title: '操作', toolbar: '#barDemo'}
            ]]
        });
    });

</script>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs" lay-event="delect"><i class="layui-icon">&#xe640;</i>批阅</a>
    <a class="layui-btn layui-btn-xs" lay-event="delect"><i class="layui-icon">&#xe640;</i>通过</a>
</script>

<script type="text/html" id="start_time">

    {{#  if(d.start_time == 0) { }}
        <span style="color: #d93c37">未开始做题</span>
    {{# } else { }}
        {{ timetrans(d.start_time) }}
    {{# } }}
</script>
<script type="text/html" id="finish_time">
    {{# if(d.finish_time == 0 && d.start_time != 0) { }}
        <span style="color: #01AAED">正在做题中</span>
    {{# } else if(d.finish_time == 0 && d.start_time == 0) { }}
        <span style="color: #d93c37">未开始做题</span>
    {{# } else { }}
        {{ timetrans(d.finish_time) }}
    {{# } }}
</script>
<script type="text/html" id="examread_pattern">
    {{#  if(d.examread_pattern == 0){ }}
        系统批阅
    {{#  } else if(d.examread_pattern == 1) { }}
        手动批阅
    {{#  } }}
</script>
<script type="text/html" id="is_examread">
    {{#  if(d.is_examread == 0){ }}
    <span style="color: #d93c37">未批阅</span>
    {{#  } else if(d.is_examread == 1) { }}
    <span style="color: #01AAED">已批阅</span>
    {{#  } }}
</script>
<script>
    //时间处理函数
    function timetrans(date){
        var date = new Date(date*1000);//如果date为10位不需要乘1000
        var Y = date.getFullYear() + '-';
        var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
        var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';
        var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
        var m = (date.getMinutes() <10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
        var s = (date.getSeconds() <10 ? '0' + date.getSeconds() : date.getSeconds());
        return Y+M+D+h+m+s;
    }
</script>

</body>
</html>